/**
 * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*!
 * \file resize_nearest_bilinear_2d.h
 * \brief
 */
#ifndef __OPS_BUILT_IN_OP_TILING_RUNTIME_RESIZE_NEAREST_BILINEAR_2D_H__
#define __OPS_BUILT_IN_OP_TILING_RUNTIME_RESIZE_NEAREST_BILINEAR_2D_H__

#include "runtime2_util.h"

namespace optiling {

constexpr int64_t BYTES_PER_BLOCK = 32;
constexpr int64_t BLOCKS_PER_VECTOR_BYTE = 8;
constexpr int64_t TILING_NO_SCALING = 0;
constexpr int64_t TILING_ONE_2_MANY = 1;
constexpr int64_t TILING_MANY_2_ONE = 2;
constexpr int64_t TILING_SMALL_W = 3;
constexpr int64_t TILING_DEFAULT = 4;
constexpr int64_t POS_NC = 0;
constexpr int64_t POS_HW = 1;
constexpr int64_t MIN_BLOCK_NUM = 8;
constexpr int64_t VDP_LEN = 4096;
constexpr int64_t INDEX_DATA_SIZE = 4;
constexpr int64_t INDEX_PER_BLOCK = BYTES_PER_BLOCK / INDEX_DATA_SIZE;
constexpr int64_t RESERVED_UB_SIZE = 8 * 1024;
constexpr int64_t RESERVED_UB_IDX_BASE_LEN = 64;
constexpr int64_t UB_IDX_SIZE = RESERVED_UB_SIZE / INDEX_DATA_SIZE - RESERVED_UB_IDX_BASE_LEN;

struct ResizeNB2DCompileInfo {
  int64_t coreNum = 1;
  int64_t ubMaxNum = 1;
  bool alignCorners = false;
  bool halfPixelCenters = false;
  int64_t resizeMode = 0;
};

struct ResizeNB2DInfoR {
  int64_t tilingKey = 0;
  int64_t subKey = 0;
  int64_t ubOffset = 0;
  int64_t usedCoreCnt = 1;
  int64_t mcPos = 0;
  int64_t coreInOffset = 0;
  int64_t coreOutOffset = 0;
  int64_t ncLoopUnit = 1;
  int64_t hLoopUnit = 1;
  int64_t wLoopUnit = 1;
  int64_t ncPerCore = 1;
  int64_t hPerCore = 1;
  int64_t wPerCore = 1;
  int64_t ncSize = 1;
  int64_t inHSize = 1;
  int64_t inWSize = 1;
  int64_t outHSize = 1;
  int64_t outWSize = 1;
  int64_t inSize = 1;
  int64_t outSize = 1;
  int64_t ubOffset2 = 0;
  int64_t inWAlign = 1;
  int64_t outWAlign = 1;
};

ge::graphStatus TilingForResizeNB2D(gert::TilingContext* context);
ge::graphStatus TilingPrepareForResizeNB2D(gert::TilingParseContext* context);
}  // namespace optiling
#endif  // __OPS_BUILT_IN_OP_TILING_RUNTIME_RESIZE_NEAREST_BILINEAR_2D_H__
